package com.atguigu.springcloud.service;

import com.atguigu.springcloud.entities.CommonResult;
import com.atguigu.springcloud.entities.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 2 * @Author: madonghui
 * 3 * @Date: 2020/10/30 13:44
 * 4
 * 打上feignclient("应用名称")
 */
@Component
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")
public interface PaymentFeignService {
    /**
     * feign的接口就是controller的注解加方法声明没有方法体
     * 此处有负载均衡，在对应名称下的服务有可能有多台
     *但是访问的时候只能访问一个服务的接口，此时就会通过配置的ribbon的负载均衡策略实现对服务的访问
     * @param id
     * @return
     */
    @GetMapping("/payment/getPaymentById/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

    @GetMapping("/payment/paymentTimeout")
    public String paymentTimeout();
}
